<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label="化验标志：" prop="hybs">
        <el-input v-model="queryParams.hybs" placeholder="请输入 " width="240px" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="车号：" prop="tpname" width="240px">
        <el-input v-model="queryParams.tpname" placeholder="请输入 " clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="化验时间：" prop="hysj">
        <el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
          range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['system:huayan:add']"
          >新增</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="success"
            plain
            icon="el-icon-edit"
            size="mini"
            :disabled="single"
            @click="handleUpdate"
            v-hasPermi="['system:huayan:edit']"
          >修改</el-button>
        </el-col> -->

      <!-- <el-col :span="1.5">
          <el-button
            type="danger"
            plain
            icon="el-icon-delete"
            size="mini"
            :disabled="multiple"
            @click="handleDelete"
            v-hasPermi="['system:huayan:remove']"
          >删除</el-button>
        </el-col> -->

      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="huayanList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="化验序列号" align="center" width="180" prop="ymqybsm" />
      <el-table-column label="车号" width="110" align="center" prop="tbGuozhong.chehao" />
      <el-table-column label="采样时间" width="180" align="center" prop="cysj" />
      <el-table-column label="录入员" align="center" prop="qyry">
        <template v-slot="scope">
          <span>{{ scope.row.qyry || '无' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="化验员" align="center" prop="czry" />
      <el-table-column label="总扣比例" align="center" prop="zk" />
      <el-table-column label="样品克数" align="center" prop="ypks" />
      <el-table-column label="杂质克数" align="center" prop="zzks" />
      <el-table-column label="不完善克数" align="center" prop="bwsls" />
      <el-table-column label="霉变克数" align="center" prop="mbls" />
      <el-table-column label="白糯克数" align="center" prop="bnls" />
      <el-table-column label="杂质比例" align="center" prop="zz" />
      <el-table-column label="杂质扣" align="center" prop="zzk" />
      <el-table-column label="水分比例" align="center" prop="sf" />
      <el-table-column label="水分扣" align="center" prop="sfk" />
      <el-table-column label="不完善比例" align="center" prop="bwsl" />
      <el-table-column label="不完善扣" align="center" prop="bwslk" />
      <el-table-column label="霉变比例" align="center" prop="mbl" />
      <el-table-column label="霉变扣" align="center" prop="mblk" />
      <el-table-column label="白糯比例" align="center" prop="bnl" />
      <el-table-column label="白糯扣" align="center" prop="bnlk" />
      <el-table-column label="色泽气味" align="center" prop="szqw" />
      <el-table-column label="备注" align="center" prop="zt" />


      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['system:huayan:edit']"
            >修改</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['system:huayan:remove']"
            >删除</el-button>
          </template>
        </el-table-column> -->
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改化验--》对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label=" " prop="id">
          <el-input v-model="form.id" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="ymqybsm">
          <el-input v-model="form.ymqybsm" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="czbh">
          <el-input v-model="form.czbh" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="szqw">
          <el-input v-model="form.szqw" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="zt">
          <el-input v-model="form.zt" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label=" " prop="hys">
          <el-input v-model="form.hys" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="czry">
          <el-input v-model="form.czry" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="hwmc">
          <el-input v-model="form.hwmc" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="bz">
          <el-input v-model="form.bz" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="rzdj">
          <el-input v-model="form.rzdj" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="zp1">
          <el-input v-model="form.zp1" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label=" " prop="zp2">
          <el-input v-model="form.zp2" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label=" " prop="hycs">
          <el-input v-model="form.hycs" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="hybs">
          <el-input v-model="form.hybs" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="xlhbs">
          <el-input v-model="form.xlhbs" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="tpname">
          <el-input v-model="form.tpname" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="rzname">
          <el-input v-model="form.rzname" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="sfname">
          <el-input v-model="form.sfname" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="yijian">
          <el-input v-model="form.yijian" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="branch">
          <el-input v-model="form.branch" placeholder="请输入 " />
        </el-form-item>
        <el-form-item label=" " prop="fenyang">
          <el-input v-model="form.fenyang" placeholder="请输入 " />
        </el-form-item>
        <el-divider content-position="center">tb信息</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddTbGuozhong">添加</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteTbGuozhong">删除</el-button>
          </el-col>
        </el-row>
        <el-table :data="tbGuozhongList" :row-class-name="rowTbGuozhongIndex"
          @selection-change="handleTbGuozhongSelectionChange" ref="tbGuozhong">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column label="序号" align="center" prop="index" width="50" />
          <el-table-column label=" " prop="gid" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gid" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="cardId" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.cardId" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="chehao" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.chehao" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="wlmcc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.wlmcc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gysbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gysbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gysdm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gysdm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gsmc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gsmc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gsbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gsbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="wlbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.wlbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="wlmc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.wlmc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ckbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ckbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ckmc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ckmc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="khbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.khbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sdfbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sdfbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="shoudf" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.shoudf" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="jhxm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.jhxm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="jlscbz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.jlscbz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yhckrxm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yhckrxm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yhkh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yhkh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="lxdh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.lxdh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpshr" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpshr" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpscsfzh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpscsfzh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpsccgbz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpsccgbz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gblx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gblx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gbzt" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gbzt" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="hytb" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.hytb" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sgtm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sgtm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sby" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sby" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="xhry" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.xhry" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yj" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yj" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddxmbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddxmbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="shsfzh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.shsfzh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddlx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddlx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zcks" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zcks" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zcmz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zcmz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sjxm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sjxm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sjdh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sjdh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sjsfz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sjsfz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ymqybsm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ymqybsm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ymsbm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ymsbm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ymsbmdy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ymsbmdy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="xcp" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.xcp" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="xcpdy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.xcpdy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zcp" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zcp" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zcpdy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zcpdy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="hyd" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.hyd" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="hyddy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.hyddy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="cmz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.cmz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="cmzdy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.cmzdy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="xcbm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.xcbm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zjshbs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zjshbs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="shfpbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.shfpbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="shfpbhdy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.shfpbhdy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddwlsl" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddwlsl" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="rkgbd" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.rkgbd" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="rkgbddy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.rkgbddy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ckgbd" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ckgbd" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ckgbddy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ckgbddy" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddysdh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddysdh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddyszl" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddyszl" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="dbh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.dbh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="dbh2" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.dbh2" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="czymc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.czymc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="czymc2" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.czymc2" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="nlmtbz1" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.nlmtbz1" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="nlmtbz2" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.nlmtbz2" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="qyry" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.qyry" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="jlscsbcs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.jlscsbcs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="jshth" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.jshth" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpscsbcs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpscsbcs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpscfhwb" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpscfhwb" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label="潮粮/干粮" prop="orclgl" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.orclgl" placeholder="请输入潮粮/干粮" />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="hysqgch" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.hysqgch" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddbdcs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddbdcs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label="规格" prop="guige" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.guige" placeholder="请输入规格" />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sapbzsc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sapbzsc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fzfs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fzfs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zds" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zds" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zzysdw" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zzysdw" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yfrq" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yfrq" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yfk" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yfk" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="bzxx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.bzxx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="dzymkz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.dzymkz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yslx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yslx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ershisibz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ershisibz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ycJzcc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ycJzcc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ycCcc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ycCcc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="bz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.bz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="czqztc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.czqztc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="lscp" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.lscp" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="lscpBj" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.lscpBj" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddysmz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddysmz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ddysjz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ddysjz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ysjzBj" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ysjzBj" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fkZdr" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fkZdr" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sdDwx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sdDwx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sdBzwmc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sdBzwmc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fwZdz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fwZdz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fwZgz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fwZgz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fwNwx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fwNwx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fwBzwm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fwBzwm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="kkRjbb" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.kkRjbb" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="gbRjbb" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.gbRjbb" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="clFbbz" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.clFbbz" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="htYcclYcKg" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.htYcclYcKg" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="ysmzBj" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.ysmzBj" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="upsapbs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.upsapbs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zzmtbs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zzmtbs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="thirdCompany" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.thirdCompany" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yhzhsfzh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yhzhsfzh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="fpph" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.fpph" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="hzddybs" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.hzddybs" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="chexc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.chexc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zhuanchangbiaoji" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zhuanchangbiaoji" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zhuanchangcishu" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zhuanchangcishu" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="photoCkqr" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.photoCkqr" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="photoZxcqr" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.photoZxcqr" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="qymc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.qymc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="khyh" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.khyh" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="yshdwmc" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.yshdwmc" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="zzjgdm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.zzjgdm" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label=" " prop="sllx" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.sllx" placeholder="请输入 " />
            </template>
          </el-table-column>
          <el-table-column label="委托付款协议照片" prop="photoWtxy" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.photoWtxy" placeholder="请输入委托付款协议照片" />
            </template>
          </el-table-column>
          <el-table-column label="自产证明" prop="photoZczm" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.photoZczm" placeholder="请输入自产证明" />
            </template>
          </el-table-column>
          <el-table-column label="承包土地合同" prop="photoCbtdht" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.photoCbtdht" placeholder="请输入承包土地合同" />
            </template>
          </el-table-column>
          <el-table-column label="状态" prop="photoZt" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.photoZt" placeholder="请输入状态" />
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listHuayan, getHuayan, delHuayan, addHuayan, updateHuayan } from "@/api/system/huayan";

export default {
  name: "Huayan",
  data() {
    const today = new Date();
    const twoWeeksAgo = new Date(today);
    twoWeeksAgo.setDate(today.getDate() - 14);

    const formatDate = (date) => {
      const year = date.getFullYear();
      const month = String(date.getMonth() + 1).padStart(2, '0');
      const day = String(date.getDate()).padStart(2, '0');
      return `${year}-${month}-${day}`;
    };
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedTbGuozhong: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 化验--》表格数据
      huayanList: [],
      // tb表格数据
      tbGuozhongList: [],
      // 日期范围
      dateRange: [formatDate(twoWeeksAgo), formatDate(today)],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cysj: null,
        ymqybsm: null,
        czbh: null,
        ypks: null,
        zzks: null,
        zz: null,
        zzk: null,
        sf: null,
        sfk: null,
        bwsls: null,
        bwsl: null,
        bwslk: null,
        mbls: null,
        mbl: null,
        mblk: null,
        bnls: null,
        bnl: null,
        bnlk: null,
        szqw: null,
        zk: null,
        hysj: null,
        zt: null,
        hys: null,
        czry: null,
        hwmc: null,
        bz: null,
        rzsl: null,
        rzdj: null,
        zp1: null,
        zp2: null,
        hycs: null,
        hybs: 2,
        xlhbs: null,
        tpname: null,
        rzname: null,
        sfname: null,
        yijian: null,
        branch: null,
        fenyang: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        id: [
          { required: true, message: " 不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询化验--》列表 */
    getList() {
      this.loading = true;
      listHuayan(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.huayanList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        cysj: null,
        ymqybsm: null,
        czbh: null,
        ypks: null,
        zzks: null,
        zz: null,
        zzk: null,
        sf: null,
        sfk: null,
        bwsls: null,
        bwsl: null,
        bwslk: null,
        mbls: null,
        mbl: null,
        mblk: null,
        bnls: null,
        bnl: null,
        bnlk: null,
        szqw: null,
        zk: null,
        hysj: null,
        zt: null,
        hys: null,
        czry: null,
        hwmc: null,
        bz: null,
        rzsl: null,
        rzdj: null,
        zp1: null,
        zp2: null,
        hycs: null,
        hybs: null,
        xlhbs: null,
        tpname: null,
        rzname: null,
        sfname: null,
        yijian: null,
        branch: null,
        fenyang: null
      };
      this.tbGuozhongList = [];
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加化验--》";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getHuayan(id).then(response => {
        this.form = response.data;
        this.tbGuozhongList = response.data.tbGuozhongList;
        this.open = true;
        this.title = "修改化验--》";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.tbGuozhongList = this.tbGuozhongList;
          if (this.form.id != null) {
            updateHuayan(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addHuayan(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除化验--》编号为"' + ids + '"的数据项？').then(function () {
        return delHuayan(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** tb序号 */
    rowTbGuozhongIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** tb添加按钮操作 */
    handleAddTbGuozhong() {
      let obj = {};
      obj.gid = "";
      obj.ddbh = "";
      obj.cardId = "";
      obj.chehao = "";
      obj.wlmcc = "";
      obj.gysbh = "";
      obj.gysdm = "";
      obj.gsmc = "";
      obj.gsbh = "";
      obj.wlbh = "";
      obj.wlmc = "";
      obj.ckbh = "";
      obj.ckmc = "";
      obj.khbh = "";
      obj.songdf = "";
      obj.sdfbh = "";
      obj.shoudf = "";
      obj.jhxm = "";
      obj.mz = "";
      obj.mzsj = "";
      obj.pz = "";
      obj.pzsj = "";
      obj.jz = "";
      obj.hykz = "";
      obj.hyjfkx = "";
      obj.yzkz = "";
      obj.jszl = "";
      obj.yzzl = "";
      obj.jsdj = "";
      obj.jsje = "";
      obj.jlscbz = "";
      obj.yhckrxm = "";
      obj.yhkh = "";
      obj.lxdh = "";
      obj.fpbh = "";
      obj.fpshr = "";
      obj.fpscxxlrsj = "";
      obj.fpscsfzh = "";
      obj.fpsccgbz = "";
      obj.gblx = "";
      obj.gbzt = "";
      obj.hytb = "";
      obj.sgtm = "";
      obj.sby = "";
      obj.xhry = "";
      obj.yj = "";
      obj.tplj = "";
      obj.ddxmbh = "";
      obj.zczm = "";
      obj.zczmtp = "";
      obj.shsfzh = "";
      obj.ddlx = "";
      obj.zcks = "";
      obj.zcmz = "";
      obj.sjxm = "";
      obj.sjdh = "";
      obj.sjsfz = "";
      obj.ymqybsm = "";
      obj.ymqysj = "";
      obj.ymsbm = "";
      obj.ymsbmdy = "";
      obj.xcp = "";
      obj.xcpdy = "";
      obj.zcp = "";
      obj.zcpdy = "";
      obj.hyd = "";
      obj.hyddy = "";
      obj.cmz = "";
      obj.cmzdy = "";
      obj.xcbm = "";
      obj.zjshbs = "";
      obj.shfpbh = "";
      obj.shfpbhdy = "";
      obj.ddwlsl = "";
      obj.rkgbd = "";
      obj.rkgbddy = "";
      obj.ckgbd = "";
      obj.ckgbddy = "";
      obj.ddysdh = "";
      obj.ddyszl = "";
      obj.dbh = "";
      obj.dbh2 = "";
      obj.czymc = "";
      obj.czymc2 = "";
      obj.nlmtbz1 = "";
      obj.nlmtbz2 = "";
      obj.qyry = "";
      obj.jlscsbcs = "";
      obj.jshth = "";
      obj.fpscsbcs = "";
      obj.fpscfhwb = "";
      obj.orclgl = "";
      obj.hysqgch = "";
      obj.ddbdcs = "";
      obj.guige = "";
      obj.sapbzsc = "";
      obj.fzfs = "";
      obj.zds = "";
      obj.zzysdw = "";
      obj.yfrq = "";
      obj.yfk = "";
      obj.bzxx = "";
      obj.dzymkz = "";
      obj.yslx = "";
      obj.cckz = "";
      obj.dzymkdz = "";
      obj.ershisibz = "";
      obj.ycJzcc = "";
      obj.ycCcc = "";
      obj.jctuCp = "";
      obj.jctuHk = "";
      obj.cctuCp = "";
      obj.cctuHk = "";
      obj.bz = "";
      obj.czqztc = "";
      obj.lscp = "";
      obj.lscpBj = "";
      obj.ddysmz = "";
      obj.ddysjz = "";
      obj.ysjzBj = "";
      obj.fkZdr = "";
      obj.sdDwx = "";
      obj.sdBzwmc = "";
      obj.fwZdz = "";
      obj.fwZgz = "";
      obj.fwNwx = "";
      obj.fwBzwm = "";
      obj.kkRjbb = "";
      obj.gbRjbb = "";
      obj.fksj = "";
      obj.clFbbz = "";
      obj.htYcclYcKg = "";
      obj.ysmzBj = "";
      obj.upsapbs = "";
      obj.kksj = "";
      obj.zzmtbs = "";
      obj.thirdCompany = "";
      obj.photoSfz = "";
      obj.yhzhsfzh = "";
      obj.fpph = "";
      obj.hzddybs = "";
      obj.chexc = "";
      obj.zhuanchangbiaoji = "";
      obj.zhuanchangcishu = "";
      obj.photoCkqr = "";
      obj.photoZxcqr = "";
      obj.qymc = "";
      obj.khyh = "";
      obj.yshdwmc = "";
      obj.zzjgdm = "";
      obj.sllx = "";
      obj.photoWtxy = "";
      obj.photoZczm = "";
      obj.photoCbtdht = "";
      obj.photoZt = "";
      this.tbGuozhongList.push(obj);
    },
    /** tb删除按钮操作 */
    handleDeleteTbGuozhong() {
      if (this.checkedTbGuozhong.length == 0) {
        this.$modal.msgError("请先选择要删除的tb数据");
      } else {
        const tbGuozhongList = this.tbGuozhongList;
        const checkedTbGuozhong = this.checkedTbGuozhong;
        this.tbGuozhongList = tbGuozhongList.filter(function (item) {
          return checkedTbGuozhong.indexOf(item.index) == -1
        });
      }
    },
    /** 复选框选中数据 */
    handleTbGuozhongSelectionChange(selection) {
      this.checkedTbGuozhong = selection.map(item => item.index)
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/huayan/export', {
        ...this.queryParams
      }, `化验信息_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
